package com.health.core.support;

import lombok.experimental.UtilityClass;


// 线程map
// 1.4的ThreadLocal 有很多方面满足不了 跨服务数据通过线程传递采用ali的ThreadLocal也是为实现
// TODO 跨服务传递的问题
@UtilityClass
public class HealthThreadLocal {

    private static InheritableThreadLocal<String> datasourceKey;

    static {
        datasourceKey = new InheritableThreadLocal();
    }


    public static String getDataSourceKey(){
        return datasourceKey.get();
    }

    public static void setDataSourceKey(String key){
        datasourceKey.set(key);
    }

    public static void deleteDataSourceKey(){
        datasourceKey.remove();
    }











}